/**
 * API接口类型定义
 * 基于后端API接口文档定义的TypeScript类型
 */

/** 统一响应格式 */
export interface ApiResponse<T = any> {
  code: number;
  data: T;
  message: string;
  errors?: Record<string, string[]>;
}

/** 学校信息 */
export interface School {
  id: number;
  name: string;
}

/** 筛选选项 */
export interface FilterOption {
  value: string;
  text: string;
  count: number;
}

/** 班级筛选条件 */
export interface ClassFilters {
  filters: Array<{
    field: string;
    title: string;
    options: FilterOption[];
  }>;
  classes_data: Array<{
    class_name: string;
    class_code: string;
  }>;
  total_classes: number;
  applied_filters: Record<string, any>;
}

/** 班级信息 */
export interface ClassInfo {
  id: number;
  school_id: number;
  class_code: string;
  class_name: string;
  college_name: string;
  grade_name: string;
  major_code: string;
  major_name: string;
  major_direction: string | null;
  education_level: string;
  student_count: string;
  academic_year_code: string;
  academic_year_name: string;
  term_code: string;
  campus_id: string;
  campus_name: string;
  created_at: string;
}

/** 班级列表响应 */
export interface ClassListResponse {
  list: ClassInfo[];
  total: number;
}

/** 教师信息 */
export interface Teacher {
  name: string;
  title: string;
  role: string;
}

/** 上课地点 */
export interface Location {
  name: string;
  type: string;
  full_name: string;
}

/** 课程节次 */
export interface Section {
  start: number;
  end: number;
}

/** 上课周次 */
export interface Weeks {
  start: number;
  end: number;
  pattern: 'every' | 'odd' | 'even';
}

/** 课程信息 */
export interface CourseInfo {
  course_name: string;
  teacher: Teacher;
  day_of_week: number;
  location: Location;
  section: Section;
  weeks: Weeks;
  courseType: string;
}

/** 班级课程表响应 */
export interface ClassCoursesResponse {
  class_info: {
    class_code: string;
    class_name: string;
    college_name: string;
    start_date: string;
  };
  courses: CourseInfo[];
}

/** 班级列表查询参数 */
export interface ClassListParams {
  school_id: number;
  academic_year?: string;
  term?: string;
  campus?: string;
  college?: string;
  grade?: string;
  major?: string;
  education_level?: string;
  page?: number;
  size?: number;
}

/** 班级筛选条件查询参数 */
export interface ClassFiltersParams {
  school_id: number;
  academic_year?: string;
  term?: string;
  campus?: string;
  college?: string;
  grade?: string;
  major?: string;
  education_level?: string;
}

/** 课程表查询参数 */
export interface ClassCoursesParams {
  class_code: string;
  school_id?: number;
}
